﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using HumanResourceManagementSystem.DataAccessLayer;

namespace HumanResourceManagementSystem.BusinessLogicLayer
{
    class ResourceManagement
    {
        public static DataTable getResources()
        {
            return SQL.getResources();
        }

        public static bool resAssign(string sResID, int empID, DateTime allocDate, DateTime freeDate)
        { 
            bool result = true;
            try
            {
                int resID = Convert.ToInt32(sResID);
                if ((empID <= 0) || (DateTime.Compare(allocDate, freeDate) >= 0)) result = false;
                else return SQL.resAssign(resID, empID, allocDate, freeDate);
            }
            catch
            {
                result = false;
            }
            return result;
        }
    }
}
